import { getUserInfoAPI } from "@/api";
import { onMounted, ref } from "vue";

// 使用省市区数据
export const useAreaList = () => {
  const areaList = ref<CityAreaList>();
  onMounted(() => {
    areaList.value = pmm.getAreaList();
  });
  return { areaList };
};
// 使用用户信息数据
export const useUserInfo = () => {
  const userInfo = ref<ProfileInfo>({
    account: "",
    avatar: "",
    birthday: "",
    fullLocation: "",
    gender: "男",
    id: "",
    nickname: "",
    profession: "",
    provinceCode: "",
    cityCode: "",
    countyCode: "",
  }); // 数据
  onMounted(() => {
    getUserInfo();
  });
  const getUserInfo = async () => {
    userInfo.value = await getUserInfoAPI();
  };
  return { userInfo };
};
